package cn.iocoder.yudao.module.digital.api.cardkeyproduct;

import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.digital.api.cardkeyproduct.dto.CardkeyProductDTO;
import cn.iocoder.yudao.module.digital.dal.dataobject.cardkeyproduct.CardkeyProductDO;
import cn.iocoder.yudao.module.digital.service.cardkeyproduct.CardkeyProductService;
import cn.iocoder.yudao.module.digital.service.cardkeysecret.CardkeySecretService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * Description:
 * Author: li
 * Date: 2024/3/25
 */
@Service
public class CardkeyProductApiImpl implements CardkeyProductApi {
    @Resource
    private CardkeyProductService cardkeyProductService;
    @Resource
    private CardkeySecretService cardkeySecretService;

    @Override
    public CardkeyProductDTO getCardKeyProductByNo(String cardKeyProductNo) {
        final CardkeyProductDO cardKeyProductDO = cardkeyProductService.getCardKeyProductByNo(cardKeyProductNo);
        return BeanUtils.toBean(cardKeyProductDO, CardkeyProductDTO.class);
    }

    @Override
    public Long getStock(String productNo) {
        return cardkeySecretService.getStock(productNo);
    }
}
